-
Notifications
You must be signed in to change notification settings - Fork 5.5k
FrontApp - new actions #16247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FrontApp - new actions #16247
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis pull request expands the FrontApp integration by introducing several new action modules. These new modules handle operations such as adding and retrieving comments, archiving and tagging conversations, assigning conversations, creating draft messages and draft replies, as well as listing conversations and teammates. In addition, version numbers have been updated on several existing modules, and the main FrontApp component has been extended with new properties and methods. The package configuration has also been updated, including a dependency upgrade for the FrontApp platform. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant Action as FrontApp Action
participant App as FrontApp App
participant API as FrontApp API
Client->>Action: Trigger action with parameters
Action->>App: Invoke corresponding method (e.g., addComment, createDraft)
App->>API: Send API request with payload
API-->>App: Return API response
App-->>Action: Deliver method result
Action-->>Client: Return summary message
sequenceDiagram
participant User as User
participant AddComment as Add Comment Action
participant API as FrontApp API
User->>AddComment: Provide comment details
AddComment->>API: Call addComment() with payload (body, authorId, attachments, etc.)
API-->>AddComment: Return confirmation and comment ID
AddComment-->>User: Deliver summary with comment ID
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/frontapp/actions/create-draft-reply/create-draft-reply.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/frontapp/actions/create-draft/create-draft.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
components/frontapp/actions/assign-conversation/assign-conversation.mjs (2)
17-24: Clarify assignee terminology in the descriptionThere appears to be a terminology mismatch. The property uses
teammateIdbut the description refers to "ID of the contact to assign". For clarity, ensure the terminology is consistent.assigneeId: { propDefinition: [ frontApp, "teammateId", ], label: "Assignee ID", - description: "ID of the contact to assign", + description: "ID of the teammate to assign to the conversation", },
27-34: Update summary message to match terminologyFor consistency with the property description update, the summary message should also refer to "teammate" rather than "contact".
- $.export("$summary", `Successfully assigned contact to conversation with ID: ${this.conversationId}`); + $.export("$summary", `Successfully assigned teammate to conversation with ID: ${this.conversationId}`);components/frontapp/actions/create-draft-reply/create-draft-reply.mjs (1)
50-61: Make cc and bcc properties optionalThe
tofield is marked as optional, butccandbccare not. Since these fields are typically optional in email communications, consider marking them as optional too.cc: { propDefinition: [ frontApp, "cc", ], + optional: true, }, bcc: { propDefinition: [ frontApp, "bcc", ], + optional: true, },components/frontapp/actions/get-comment/get-comment.mjs (1)
27-34: Consider using response ID in summary for consistencyThe action correctly retrieves a comment and returns it. However, for consistency with the get-teammate action, consider using the ID from the response rather than
this.commentIdin the summary.- $.export("$summary", `Successfully retrieved comment with ID: ${this.commentId}`); + $.export("$summary", `Successfully retrieved comment with ID: ${response.id}`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
components/frontapp/actions/add-comment/add-comment.mjs(1 hunks)components/frontapp/actions/archive-conversation/archive-conversation.mjs(1 hunks)components/frontapp/actions/assign-conversation/assign-conversation.mjs(1 hunks)components/frontapp/actions/create-draft-reply/create-draft-reply.mjs(1 hunks)components/frontapp/actions/create-draft/create-draft.mjs(1 hunks)components/frontapp/actions/get-comment/get-comment.mjs(1 hunks)components/frontapp/actions/get-teammate/get-teammate.mjs(1 hunks)components/frontapp/actions/import-message/import-message.mjs(1 hunks)components/frontapp/actions/list-conversations/list-conversations.mjs(1 hunks)components/frontapp/actions/list-teammates/list-teammates.mjs(1 hunks)components/frontapp/actions/receive-custom-messages/receive-custom-messages.mjs(1 hunks)components/frontapp/actions/reply-to-conversation/reply-to-conversation.mjs(1 hunks)components/frontapp/actions/send-new-message/send-new-message.mjs(1 hunks)components/frontapp/actions/tag-conversation/tag-conversation.mjs(1 hunks)components/frontapp/actions/update-conversation/update-conversation.mjs(1 hunks)components/frontapp/frontapp.app.mjs(5 hunks)components/frontapp/package.json(2 hunks)components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs(1 hunks)components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: pnpm publish
🔇 Additional comments (36)
components/frontapp/actions/send-new-message/send-new-message.mjs (1)
8-8: Version Update Verified.
The version update from"0.2.5"to"0.2.6"is a straightforward metadata change and does not affect the functionality of the module. This update aligns with version management across related modules.components/frontapp/actions/receive-custom-messages/receive-custom-messages.mjs (1)
8-8: Version Bump Acknowledged.
The version update from"0.0.3"to"0.0.4"is correctly applied without any modifications to the logic or structure.components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs (1)
10-10: Version Increment Update.
The change updating the version to"0.0.2"is simple and consistent with the coordinated version bumps across the FrontApp modules.components/frontapp/actions/update-conversation/update-conversation.mjs (1)
8-8: Version Bump Noted.
Incrementing the version to"0.1.6"is a non-functional update and is in line with similar updates in other FrontApp actions.components/frontapp/actions/reply-to-conversation/reply-to-conversation.mjs (1)
8-8: Version Update for Reply-to-Conversation Action.
The updated version"0.0.3"reflects a minor version increment with no changes to functionality. This is consistent with the systematic versioning approach used across the FrontApp integration.components/frontapp/actions/import-message/import-message.mjs (1)
8-8: Version updated appropriately.The version increment from the previous version to "0.1.7" reflects ongoing maintenance of the module. This type of version updating is consistent with semantic versioning practices.
components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs (1)
9-9: Version increment looks good.The version has been updated from "0.0.1" to "0.0.2", which is appropriate for tracking changes to this module. The increment follows semantic versioning practices for non-breaking maintenance updates.
components/frontapp/package.json (2)
3-3: Package version update is appropriate.The version increment from "0.5.1" to "0.6.0" correctly follows semantic versioning for adding new features (the new actions being added in this PR) in a backward-compatible manner.
13-13:❓ Verification inconclusive
Significant platform dependency update.
The update from "@pipedream/platform": "^0.10.0" to "^3.0.3" represents a major version jump. This typically indicates significant changes in the platform API. Ensure all components have been tested with this new dependency version.
🏁 Script executed:
#!/bin/bash # Check if there are any compilation errors after the dependency update grep -r "Error:" .github/workflows/publish-*.yml || echo "No error logs found in workflow files" # Check if there are any recent changes to the platform API usage in this PR git diff HEAD~1 HEAD --name-only | grep -v "package.json" | xargs grep -l "@pipedream/platform" 2>/dev/null || echo "No other files using @pipedream/platform found in diff"Length of output: 413
Significant Platform Dependency Update Confirmed
- In
components/frontapp/package.json(line 13), the dependency update to"@pipedream/platform": "^3.0.3"represents a major jump from^0.10.0, which likely introduces breaking API changes.- Verification scripts indicate there are no workflow error logs and no other files in this PR reference the
@pipedream/platformdependency.- Despite these checks, please ensure that all dependent components have comprehensive tests run against them to verify compatibility with the new API version.
components/frontapp/actions/create-draft/create-draft.mjs (5)
1-3: Good import structure.The imports follow the established pattern in other FrontApp actions, importing the frontApp app and utility functions.
4-9: Well-structured action metadata.The action definition includes all required metadata: key, name, description, version, and type. The description effectively explains the purpose of the action and includes a link to the relevant documentation.
10-62: Props defined appropriately.The props are well-structured and include proper types, labels, and descriptions. The optional fields are correctly marked. The reuse of existing prop definitions from the frontApp app is good practice for maintaining consistency.
63-81: Run method implementation looks good.The implementation correctly uses the frontApp.createDraft method to send the request with all provided parameters. The conditional setting of Content-Type header for attachments is proper practice.
The success message includes the draft ID, which is helpful for users to track their created content.
75-77:❓ Verification inconclusive
Verify attachments handling.
The code sets "Content-Type: multipart/form-data" when attachments are present, which is correct. Make sure the createDraft method in the frontApp.app.mjs file correctly handles this content type and properly processes the attachments.
🏁 Script executed:
#!/bin/bash # Check how attachments are handled in the createDraft method grep -A 15 "createDraft" components/frontapp/frontapp.app.mjs # Also check if there are examples of attachment handling in other actions grep -r "attachments.*multipart/form-data" --include="*.mjs" components/frontapp/Length of output: 791
Confirm Multipart Form Data Handling in createDraft
The code in
components/frontapp/actions/create-draft/create-draft.mjscorrectly sets the"Content-Type: multipart/form-data"header when attachments are present. However, thecreateDraftmethod incomponents/frontapp/frontapp.app.mjsmerely spreads the request arguments intomakeRequestwithout explicitly handling multipart data. Please verify thatmakeRequestproperly processes the provided headers and that the overall attachment upload flow is correctly implemented.components/frontapp/actions/add-comment/add-comment.mjs (1)
1-61: Well-structured implementation for adding comments to FrontApp conversationsThe action is well-implemented with appropriate properties, documentation references, and error handling. The code correctly handles attachments by setting the proper Content-Type header when needed.
components/frontapp/actions/list-conversations/list-conversations.mjs (1)
1-37: Clean pagination implementation for listing conversationsThe action properly implements pagination using async iteration and handles the summary message with the correct pluralization logic.
components/frontapp/actions/archive-conversation/archive-conversation.mjs (1)
1-29: Implementation looks good, follows the standard action patternThe action is well-structured with proper imports, metadata, props, and implementation. It correctly uses the FrontApp API to archive a conversation and provides appropriate feedback via the summary export.
components/frontapp/actions/tag-conversation/tag-conversation.mjs (1)
25-52: Well-implemented tag merging logicThe action effectively retrieves the existing tags, merges them with new tags using Set for deduplication, and updates the conversation. The use of optional chaining with
tags?.mapis a good defensive coding practice to handle potential null/undefined values.components/frontapp/actions/get-teammate/get-teammate.mjs (1)
19-26: Good practice using the response ID in summaryThe action correctly uses the ID from the response (
response.id) in the summary message rather than reusingthis.teammateId. This is a good practice as it confirms successful retrieval with the actual returned data.components/frontapp/actions/get-comment/get-comment.mjs (1)
17-25: Effective use of dependent prop patternGood implementation of the dependent prop pattern where commentId is linked to the selected conversationId. This creates a better UX by dynamically filtering available comments based on the selected conversation.
components/frontapp/actions/list-teammates/list-teammates.mjs (4)
4-8: LGTM! Action metadata is well-defined.The action is properly defined with a clear key, descriptive name, helpful documentation link in the description, appropriate initial version, and correct action type.
9-17: Props declaration looks good.The props section correctly includes the FrontApp app reference and the maxResults prop with its definition properly linked to the FrontApp app.
18-30: Implementation is using pagination correctly.The run method effectively uses the paginate function to handle large result sets, with proper argument passing and result collection.
32-36: Nice touch with the dynamic summary message.The summary message correctly handles singular/plural forms based on the result count, which improves the user experience.
components/frontapp/frontapp.app.mjs (12)
168-189: LGTM! Well-structured commentId prop definition.The commentId prop is properly defined with appropriate type, label, and description. The options method correctly uses paginateOptions to fetch and format comments for selection.
207-213: LGTM! Good maxResults property definition.The maxResults property is well-defined with appropriate type, label, description, and a reasonable default value of 100.
231-234: Fixed variable naming in getConfig.The variable name has been corrected from what appears to have been a typo (oriignalData → originalData), and it's now consistently used.
361-368: LGTM! Clean getTeammate method implementation.The getTeammate method follows the established pattern for API methods in this file, with proper parameter destructuring and path construction.
369-376: LGTM! Well-implemented getConversation method.The getConversation method follows the established pattern and correctly constructs the API path.
377-384: LGTM! Good getComment method implementation.The getComment method is properly implemented following the existing pattern.
385-392: LGTM! Properly implemented listComments method.The listComments method correctly handles the conversationId parameter and constructs the appropriate API path.
393-401: LGTM! Well-structured addComment method.The addComment method is correctly implemented with the POST method and proper path construction.
402-410: LGTM! Good createDraft method implementation.The createDraft method is well-implemented with the POST method and correct path construction.
411-419: LGTM! Well-implemented createDraftReply method.The createDraftReply method follows the established pattern and uses the correct API path.
420-428: LGTM! Good updateConversationAssignee method.The updateConversationAssignee method is properly implemented with the PUT method and appropriate API path.
435-457: LGTM! Improved args handling in paginateOptions.The paginateOptions method now properly handles the args parameter with a default empty object, correctly spreads the args into the request, and properly merges any params from args into the request params.
luancazarine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927, LGTM! Ready for QA!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (7)
components/frontapp/actions/create-draft/create-draft.mjs (2)
10-94: Consider adding validation for required fieldsCritical fields like
bodyandauthorIdlack validation before making the API request.Add validation at the beginning of the run method:
async run({ $ }) { + // Validate required fields + if (!this.body) { + throw new Error("Body is required"); + } + if (!this.authorId) { + throw new Error("Author ID is required"); + } + if (!this.channelId) { + throw new Error("Channel ID is required"); + } const response = await this.frontApp.createDraft({ ...
67-72: Improve property description for more clarityThe
modeproperty does not have a descriptive label or information about possible values.Enhance the mode property definition:
mode: { propDefinition: [ frontApp, "mode", ], + label: "Message Mode", + description: "Specify the mode of the message (e.g., email, chat)", },components/frontapp/actions/list-comment-mentions/list-comment-mentions.mjs (1)
33-49: Check for added error handling of pagination
The asynchronous iteration overitemsworks correctly, collecting mentions into theresultsarray. There is no explicit error handling if an invalid comment ID or conversation ID is passed, but that might be handled by the underlying API call. Consider adding error handling or user-friendly messages to catch potential API failures.components/frontapp/actions/list-comments/list-comments.mjs (1)
24-41: Pagination logic review
The pagination approach is consistent with other actions, accumulating results before returning them. As with the other action, you might add optional error handling for scenarios whereconversationIdis invalid or the API call fails.components/frontapp/frontapp.app.mjs (3)
269-275: maxResults default
A default of 100 is reasonable for most pagination scenarios. Monitor performance if users need a larger limit.
423-430: getTeammate method
This retrieves a teammate’s details by ID with no known issues. Consider error handling for nonexistent IDs if needed.
431-438: getConversation method
Straightforward approach for retrieving conversation data. Similar caution: handle errors if conversation does not exist.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
components/frontapp/actions/create-draft-reply/create-draft-reply.mjs(1 hunks)components/frontapp/actions/create-draft/create-draft.mjs(1 hunks)components/frontapp/actions/list-comment-mentions/list-comment-mentions.mjs(1 hunks)components/frontapp/actions/list-comments/list-comments.mjs(1 hunks)components/frontapp/actions/list-conversations/list-conversations.mjs(1 hunks)components/frontapp/actions/list-teammates/list-teammates.mjs(1 hunks)components/frontapp/frontapp.app.mjs(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- components/frontapp/actions/create-draft-reply/create-draft-reply.mjs
- components/frontapp/actions/list-conversations/list-conversations.mjs
- components/frontapp/actions/list-teammates/list-teammates.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
🔇 Additional comments (24)
components/frontapp/actions/create-draft/create-draft.mjs (2)
1-9: Great structure and documentation linkThe component has a well-structured definition with a clear description and link to official documentation.
111-114: Effective conditional header handlingGood implementation of conditional headers for attachments using the utility function.
components/frontapp/actions/list-comment-mentions/list-comment-mentions.mjs (2)
1-2: Import statement looks good
No issues found with the import offrontApp.
3-32: Review of action definition and props
This structure effectively defines thefrontapp-list-comment-mentionsaction, includingconversationId,commentId, andmaxResultsprops. Everything appears consistent with other FrontApp actions, and the property definitions referencingconversationIdandcommentIdare well-scoped.components/frontapp/actions/list-comments/list-comments.mjs (1)
1-23: Action definition and prop usage
The code properly defines a new action, referencesfrontApp, and usesconversationIdandmaxResultsprop definitions. The naming and description match the intended functionality to list conversation comments.components/frontapp/frontapp.app.mjs (19)
71-73: No concerns with label/value mapping
Mappingid, nameinto{ label: name, value: id }is consistent with other option mappers.
168-189: Prop definition for commentId
This prop uses thelistCommentsfunction to populate possible comments under a specified conversation. The approach is logical and should help users pick from existing comments.
190-206: Prop definition for teamId
Fetching team listings and mapping them to an ID and name is straightforward. No issues found.
207-229: Signature ID prop
Enabling the user to attach a specific signature is a great enhancement. The optional aspect is well-handled.
230-239: Mode prop
Themodeenum is clearly defined and reflects possible “private” or “shared” states for drafts.
240-245: Prop for shouldAddDefaultSignature
This boolean prop is clear. Good practice to note that it’s ignored ifsignatureIdis provided.
246-251: Prop for quoteBody
No issues. This optional field is relevant only on email channels, as stated.
293-296: Renaming variables for clarity
The change fromoriignalDatatooriginalDatais a good fix. Avoid other typos or misspellings to maintain clarity.
439-446: getComment method
Retrieves a comment by ID. Matches the logic of the other “get” methods.
447-454: listComments method
Lists comments for a conversation. Implementation is aligned with the new actions referencing it.
455-460: listTeams method
No issues. Consistent approach for retrieving team data.
461-468: listSignatures method
No issues. Straightforward method.
469-476: listCommentMentions method
Supports the new action for listing mentions in a comment. Clear, consistent approach.
477-485: addComment method
Useful method for adding a comment to a conversation. Implementation is consistent with the broader design.
486-494: createDraft method
Allows creation of a draft message. Properly uses the/draftsendpoint.
495-503: createDraftReply method
Similar tocreateDraft, but references a conversation. Correct usage of endpoints.
504-512: updateConversationAssignee method
Implements the assignment update via PUT request. Straightforward logic.
519-519: args destructuring
No issues withargs = {}. Ensures a default object to avoid undefined.
538-540: Argument handling in paginateOptions
The usage...args?.paramsis consistent for optional chaining. Looks good.
Resolves #16218
Summary by CodeRabbit
New Features
Chores